package top.kaoshanji.p3ch13a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.security.Provider;
import java.security.Security;
import java.util.Set;

/**
 * 代码清单-p3ch13a-425页a：Provider类的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/2/8 11:12
 */
public class ListProviders {

    private static final Logger logger = LogManager.getLogger(ListProviders.class);

    public static void main(String[] args) {
        logger.info("...代码清单-p3ch13a-425页a：Provider类的使用示例...");

        Provider[] providers = Security.getProviders();
        for (Provider provider: providers) {
            logger.info("...密码框架供应商名称：{}...", provider.getName());

            Set<Provider.Service> services = provider.getServices();
            for (Provider.Service service: services) {
                logger.info("...供应商算法：{}...类名：{}...", service.getAlgorithm(), service.getClassName());
            }
            logger.info("..........");
        }
    }

}
